

from fastapi import APIRouter,Depends
from models import Project,User,ProjectMembers,ProjectFiles,ProjectGroups
from scheams import (Project_Pydantic,ProjectIn_Pydantic
                     ,Response200,Response400
                     ,ProjectMembers_Pydantic,ProjectInWithId_Pydantic
                     ,ProjectMembersWithId_Pydantic
                     ,ProjectFiles_Pydantic,ProjectGroups_Pydantic
                     ,User_Pydantic)
from core import deps,config,get_logger

logger = get_logger(__name__)

common = APIRouter(tags=["公共信息"],dependencies=[Depends(deps.get_current_user)])

@common.get("/getDepartments",summary="获取部门")
async def getDepartments():
    return Response200(data=config.settings.Department.list())

@common.get("/getProjectGroups",summary="获取评审组")
async def getProjectGroups():
    # 滤掉 州市创新委员会
    return Response200(data=list(filter(lambda x: x != "州市创新委员会",config.settings.ProjectGroupName.list())))

@common.get("/getProjectClass",summary="获取项目类别")
async def getProjectClass():
    return Response200(data=config.settings.ProjectClass.list())

@common.get("/getProjectType",summary="获取项目类型")
async def getProjectType():
    return Response200(data=config.settings.ProjectType.list())

@common.get("/getProjectGroupMemberRole",summary="获取项目评审组成员角色")
async def getProjectGroupMemberRole():
    return Response200(data=config.settings.ProjectGroupMemberRole.list())